package com.beta.em.order;

/**
 * Created by lichao on 2016/11/24.
 */
public enum ShipmentStatus {

    INIT("-", "初始状态"),
    UNPICKED("unpicked", "待接单"),
    PICKING("picking", "出货中"),
    SHIPPING("shipping", "送货中"),
    COMPLETED("completed", "已送达");

    private String value;
    private String cnValue;

    ShipmentStatus(String value, String cnValue) {
        this.value = value;
        this.cnValue = cnValue;
    }

    public String getCnValue() {
        return cnValue;
    }

    public String getValue() {
        return value;
    }

    public static ShipmentStatus getStatus(String value) {
        for (ShipmentStatus orderStatus: values()) {
            if (orderStatus.getValue().equals(value)) {
                return orderStatus;
            }
        }
        return null;
    }

    public static String getCnValue(String value) {
        ShipmentStatus status = getStatus(value);
        return status != null ? status.getCnValue() : "";
    }

}